const BASE_URL='https://api-hmugo-web.itheima.net/api/public/v1/'

export const post=(url,data)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			url:BASE_URL+url,
			method:'POST',
			header: {
			        'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
			},
			data:data || {},
			success:res=>{
				resolve(res)
			},
			fail:err=>{
				reject(err)
			}
		})
	})
}

export const get=(url,data)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			url:BASE_URL+url,
			method:'GET',
			header: {
			        'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
			},
			data:data || {},
			success:res=>{
				resolve(res)
			},
			fail:err=>{
				reject(err)
			}
		})
	})
}